/*
Copyright (c) (2012) (Anthony Bigot, Vincent Loppin)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions: The above copyright notice and
this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef DRAWABLE_H
#define DRAWABLE_H

#include <vector>
#include <Util/Vec4.h>
#include <QMap>
#include <QImage>

#define MACRO_DRAWABLE_NAME(n) \
    QString getClassName() const { return n; }; \
    static QString getStaticClassName() { return n; };

namespace Core{

/*! \class Drawable
  * \brief (virtual) Management of the drawable elements
  * \author Anthony BIGOT & Vincent LOPPIN
  * \version 1.0
  *
  * Each drawable element must contain a public method "draw"
  * and two private methods "drawWithTexture" and "drawWithColor"
  *
  */
class Drawable
{
public:
    Drawable();

    /// Draw the element
    virtual void draw() const = 0;

    /// Draw the element with texture
    virtual void drawWithTexture() const = 0;

    /// Draw the element with color
    virtual void drawWithColor() const = 0;

    /// Return a string value that indentify the final class
    ///\warning Use MACRO_DRAWABLE_NAME(n) with a uniq identifier to override
    virtual QString getClassName() const = 0;

    /// Return the color of the element (applied only if no texture)
    inline const Vec4d & getColor() const { return color; }

    /// Set the color of the element (applied only if no texture)
    ///\param col Color to apply (R,G,B,A)
    inline void setColor(const Vec4d &col) { color = col; }

protected:
    Vec4d                   color;              ///< Color of the element if no texture
//    Rendering::Texture *	texture;			///< Texture to apply

};

}

#endif // DRAWABLE_H
